From 26dcbab53b3f42acae40711461e4b8b2e818d5c2 Mon Sep 17 00:00:00 2001
From: Andriy Grytsenko <andrej@rep.kiev.ua>
Date: Sat, 24 Nov 2012 02:27:50 +0200
Subject: [PATCH 10/11] [#3589448]Folder view grabs focus only once.

The folder view grabs focus on entry ativation but callback does not
reset idle handler id therefore never grab focus after that again.
---
 src/main-win.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/main-win.c b/src/main-win.c
index b3e462a..8375838 100644
--- a/src/main-win.c
+++ b/src/main-win.c
@@ -138,8 +138,12 @@ static void fm_main_win_class_init(FmMainWinClass *klass)
 static gboolean idle_focus_view(gpointer user_data)
 {
     FmMainWin* win = (FmMainWin*)user_data;
+    /* window might be destroyed already */
+    if(g_source_is_destroyed(g_main_current_source()))
+        return FALSE;
     if(win->folder_view)
         gtk_widget_grab_focus(GTK_WIDGET(win->folder_view));
+    win->idle_handler = 0;
     return FALSE;
 }
 
-- 
1.8.0.1

